package pta.java.ch01.ex03;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextLine()) {
            String input = scanner.nextLine();
            int num = Integer.parseInt(input);
            if (num >= 10000 && num <= 20000) {
                System.out.println(
                        Integer.toBinaryString(num) + "," +
                                Integer.toOctalString(num) + "," +
                                Integer.toHexString(num)
                );
            } else {
                int sum = 0;
                for (char c : input.toCharArray()) {
                    if (Character.isDigit(c)) {
                        sum += Character.getNumericValue(c);
                        System.out.print(c + " ");
                    }
                }
                System.out.println(sum);
            }
        }
    }
}